package com.example.child_protection.dao;

import com.example.child_protection.model.BaseModel;

import java.io.Serializable;
import java.util.List;

/**
 * @date 2018-11-2
 *
 * @author  Biz
 * @param <MODEL>
 * @param <IDCLAZZ>
 */
public interface BaseDao <MODEL extends BaseModel, IDCLAZZ extends Serializable> {

    /**
     * @Title: findId
     * @Description: id查询
     * @param id
     * @return
     * @return MODEL
     */
    public MODEL findId( IDCLAZZ id );

    /**
     * @Title: findPage
     * @Description: 分页查询
     * @param model
     * @return
     * @return MODEL
     */
    public List<MODEL> findPage(MODEL model );

    /**
     * @Title: count
     * @Description: 统计
     * @param model
     * @return
     * @return MODEL
     */
    public int count(MODEL model );

    /**
     * @Title: insert
     * @Description: 插入
     * @param model
     * @return
     * @return int
     */
    public int insert( MODEL model );

    /**
     * @Title: insertSelective
     * @Description: 插入，若Model属性不为null, 则新增该属性; null则反之.
     * @param model
     * @return
     * @return int
     */
    public int insertSelective( MODEL model );

    /**
     * @Title: update
     * @Description: 修改
     * @param model
     * @return
     * @return int
     */
    public int update( MODEL model );

    /**
     * @Title: delete
     * @Description: 删除
     * @param id
     * @return
     * @return int
     */
    public int delete( IDCLAZZ id );

    /**
     * @Title: deleteForLogic
     * @Description: 删除(逻辑删除)
     * @param model
     * @return
     * @return int
     */
    public int deleteForLogic(MODEL model );

    /**
     * @Title: updateSelective
     * @Description: 局部修改属性，若Model属性不为null, 则修改该属性; null则反之.
     * @param model
     * @return
     * @return int
     */
    public int updateSelective( MODEL model );
}
